import type { RouteRecordRaw } from "vue-router";
const routes: RouteRecordRaw[] = [
  {
    path: "/login",
    name: "login",
    component: () => import("@/views/Login/index.vue"),
  },
  {
    path: "/home",
    // name: "home",
    component: () => import("@/views/Home/index.vue"),
    redirect:"/home/news", // 重定向
    children:[ //子路由
      {
        path:"news",
        name:"news",
        component:()=>import("@/views/Home/components/News/index.vue")
      },
      {
        path:"music",
        name:"music",
        component:()=>import("@/views/Home/components/Music/index.vue"),
        children:[
          {
            path: "item/:name",
            name: "musicItem",
            component: () =>
              import("@/views/Home/components/Music/components/Item.vue"),
          },
        ]
      },
      {
        path:"play",
        name:"play",
        component:()=>import("@/views/Home/components/Play/index.vue")
      }
    ]
  },
  {
    path: "/404",
    component: () => import("@/components/404/index.vue"),
  },
  {
    path: "/:pathMatch(.*)*",
    redirect: "/404",
  },
  {
    path: "/",
    redirect: "home",
  },
];

export default routes;
